[6/15] Make settings resolution thread-safe - #159
Open
UnknownJoe796 wants to merge 1 commit into
Open
Conversation
UnknownJoe796
commented
Jul 29, 2026
UnknownJoe796
force-pushed
the
v53/auth-backoff
branch
from
July 29, 2026 22:54
923566f to
5af890d
Compare
UnknownJoe796
force-pushed
the
v53/settings-thread-safety
branch
from
July 29, 2026 22:54
b2759a2 to
ed1d009
Compare
Concurrent first-touch of a setting could resolve it more than once. Transformed results are now published as an immutable snapshot: reads are lock-free (once a setting is resolved, an immutable Map makes it visible for good via a @volatile field), and writes replace the whole map under a single lock (copy-on-write) -- cheap, since each setting resolves at most once, and in production every setting is pre-resolved single-threaded during ready(). A single reentrant lock guards transformation because a setting's getter may resolve its own dependencies by calling get() again on the same thread; per-setting locks could deadlock on mutually-dependent settings instead. (cherry picked from commit ed1d009)
UnknownJoe796
force-pushed
the
v53/auth-backoff
branch
from
July 30, 2026 02:19
5af890d to
2f0e750
Compare
UnknownJoe796
force-pushed
the
v53/settings-thread-safety
branch
from
July 30, 2026 02:19
ed1d009 to
4067167
Compare
Contributor
Author
|
Much better. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Concurrent first-touch of a setting could resolve it more than once. Resolution
is now guarded.
Note for reviewers: this lands the
ConcurrentHashMapform. Theaccess-loggingPR later in the stack refines it to a@Volatilecopy-on-write map. The fix is real either way; only the implementation evolves.
Flagged so the later change is not a surprise.